Skip to content

fix: remove_all_tools missing MCP and reasoning item types#2700

Merged
seratch merged 3 commits intoopenai:mainfrom
joaquinhuigomez:fix/remove-all-tools-missing-types
Mar 21, 2026
Merged

fix: remove_all_tools missing MCP and reasoning item types#2700
seratch merged 3 commits intoopenai:mainfrom
joaquinhuigomez:fix/remove-all-tools-missing-types

Conversation

@joaquinhuigomez
Copy link
Copy Markdown
Contributor

@joaquinhuigomez joaquinhuigomez commented Mar 17, 2026

No description provided.

…put history

The `_remove_tool_types_from_input` function was missing several item types
that `_remove_tools_from_items` already handled for RunItem objects:
- `reasoning` items become orphaned when surrounding tool calls are stripped
- `mcp_call`, `mcp_list_tools`, `mcp_approval_request`, `mcp_approval_response`
  were not filtered, leaking MCP tool items through handoff boundaries

Also adds MCPListToolsItem, MCPApprovalRequestItem, and MCPApprovalResponseItem
to `_remove_tools_from_items` for consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the bug Something isn't working label Mar 17, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@seratch seratch marked this pull request as draft March 17, 2026 23:25
…filters

Assert items are not str before calling .get() to satisfy mypy's
union-attr check on the input_history item type.
@seratch seratch marked this pull request as ready for review March 21, 2026 00:12
@seratch seratch added this to the 0.13.x milestone Mar 21, 2026
@seratch seratch merged commit 49f593b into openai:main Mar 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants